<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class View {
	
	public $data;

	public function __construct(){
		$this->CI =& get_instance();
		$this->data['portlet_type'] = 'View';
	}
	
	public function set_portlet_title($title){
		$this->data['portlet_title'] = $title;
	}
	
	public function set_menu($menu){
		$this->data['menu'] = $menu;
	}
	
	public function set_portlet_style($style){
		$this->data['portlet_style'] = $style;
	}
	
	public function set_view($view){
		$this->data['view'] = $view;
	}

	public function show(){
		if($this->CI->session->userdata('logged_in'))
		{
			$session_data = $this->CI->session->userdata('logged_in');
			$this->data['title'] = 'Home';
			$this->data['username'] = $session_data['username'];
			$this->data['nama'] = $session_data['nama'];
			$this->CI->load->view('main', $this->data);
		}
		else
		{
			//If no session, redirect to login page
			redirect('login', 'refresh');
		}
	}
}